using System.Collections;

namespace CSharpPro._1020;

public class Demo03
{
    public void Sort(double[] a)
    {
        double temp;
        for (int i = 0; i < a.Length - 1; i++)
        {
            for (int j = 0; j < a.Length - i - 1; j++)
            {
                if (a[j] < a[j + 1])
                {
                    temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }

            }
        }
    }

    public static void TestPrint2()
    {

    }

    public void TestPrint()
    {
        int[] arr = new int[5];
        arr[0] = 1;
        arr[4] = 5;

        String[] arr2 = new string[5];
        arr2[0] = "1";
        arr2[4] = "5";

        //Console.WriteLine(arr2[6]);
        int[] arr3 = { 1, 2, 3, 4 };
        //二维数组
        int[,] arr4 = new int[2, 3];
        arr4[0, 0] = 1;
        arr4[1, 2] = 2;

        String[,] arr5 = { { "1", "2", "3" } };

        int[] arr6 = { 1, 2, 3, 4, 5 };
        Array.Sort(arr6); //升序
        Array.Reverse(arr6); //降序

        foreach (int i in arr6)
        {
            Console.WriteLine(i + "\t");

        }

        Student[] students = new Student[5];
        students[0] = new Student();

        ArrayList list = new ArrayList();
        Hashtable hashtable = new Hashtable();

        list.AddRange(arr6);
        list.Add(9);
        list.Add("abc");
        Console.WriteLine();
        foreach (object o in list)
        {
            Console.WriteLine(o + "\t");
        }

        list.Remove(6);
        list.RemoveAt(2);
        list.RemoveRange(1, 2);
        hashtable.Add("1", "111");
        hashtable.Add("2", "222");
        hashtable.Add("3", "333");
        Console.WriteLine(hashtable["1"]);
        foreach (DictionaryEntry entry in hashtable)
        {
            Console.WriteLine(entry.Key + "__________" + entry.Value);
        }

        hashtable.Remove(2);
        // Math.Floor(1.2);
    }
}